import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/api/producer/list',
    method: 'get',
    params: query
  })
}

export function fetchAllProducers(query) {
  return request({
    url: '/api/producer/list-all',
    method: 'get',
    params: query
  })
}

export function fetchProducer(id) {
  return request({
    url: '/api/producer/detail',
    method: 'get',
    params: { id }
  })
}

export function createProducer(data) {
  return request({
    url: '/api/producer/create',
    method: 'post',
    data
  })
}

export function updateProducer(data) {
  return request({
    url: '/api/producer/update',
    method: 'post',
    data
  })
}

export function deleteProducer(params) {
  console.log(params)
  return request({
    url: '/api/producer/delete/' + params.producerId,
    method: 'post',
    params
  })
}
